home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip1292.zip / PRINTQ.C < prev    next >
C/C++ Source or Header  |  1992-12-26  |  1KB  |  47 lines

  1. /* printq.c 12-22-91 Robert Mashlan, Public Domain
  2.  
  3.    A small program that utilizes the prnspool module,
  4.    which is an interface to the DOS program PRINT.COM
  5.  
  6. */
  7.  
  8. #include "prnspool.h"
  9. #include <stdio.h>
  10. #include <string.h>
  11.  
  12. int main(int argc, char **argv )
  13. {
  14.       char far *files;
  15.       int i;
  16.       int addfiles = 1;
  17.  
  18.       if (!printspool_installed())
  19.       {
  20.             printf("print.com not installed\n");
  21.             return 0;
  22.       }
  23.       for (i = 1; i < argc; i++)
  24.       {
  25.             if (stricmp(argv[i],"/T") == 0)
  26.                   printspool_cancel();    /* cancel all files in queue */
  27.             else if (stricmp(argv[i],"/C") == 0)
  28.                   addfiles = 0;           /* cancel all listed files */
  29.             else if (stricmp(argv[i],"/P") == 0)
  30.                   addfiles = 1;           /* add all listed files */
  31.             else
  32.             /* here the specified file should really have the full pathname */
  33.             {
  34.                   if (addfiles)
  35.                         printspool_submit(argv[i]);
  36.                   else  printspool_remove(argv[i]);
  37.                   if (printspool_errno)
  38.                         puts(printspool_errlist[printspool_errno]);
  39.             }
  40.       }
  41.       printf("files currently in queue:\n");
  42.       for (files = printspool_getqueue(); *files; files += 64)
  43.             printf("\t%Fs\n", files);
  44.       printspool_endhold();
  45.       return 0;
  46. }
  47.